/**
 * Created by Sean Patrick Floyd (<a
 * href="mailto:sean@mostlymagic.com">sean@mostlymagic.com</a>) on 20.05.2010.
 */
package com.google.code.imds4j.impl.map;

import java.util.Collection;

import com.google.code.imds4j.api.DataStructure;
import com.google.code.imds4j.api.Query;

// TODO SPF: this is awful, make this an inner class of MapDataStructure
class NotQuery<K, V> implements Query<V> {

    private final DataStructure<K, V> dataStructure;
    private final Query<V> inner;

    public NotQuery(final Query<V> inner,
            final DataStructure<K, V> dataStructure) {
        this.inner = inner;
        this.dataStructure = dataStructure;
    }

    @Override
    public Collection<V> get() {
        final Collection<V> values = this.dataStructure.values();
        values.removeAll(this.inner.get());
        return values;
    }

}